<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['设备安装管理','审核管理','审核人员']" icon="fa fa-wrench"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>

	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>审核人员</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn" style="width: calc(100% - 220px);">
								<button class="btn btn-primary" (click)="addExamineStaff(addUserNameModal)">添加</button>
							</div>
						</div>
						<div class="table_scroll">
							<table
								class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>操作</th>
										<th>姓名</th>
										<th>添加时间</th>
										<th>启用状态</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i">
										<td>
											<button type="button" (click)="examineAllocation(row, allocationModal, i)">审核分配</button>
											<button type="button" (click)="examineDelete(row)">删除</button>
										</td>
										<td>{{row.userName}}</td>
										<td>{{row.createTime}}</td>
										<td class="smart-form" style="padding: 7px 10px;">
											<input style="margin-right: 5px;display: none;" name="status" class="isEnable" type="checkbox"
												[checked]="row.isEnable" [id]='row.userId'>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
								(onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i
									class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>
<!-- 新增审核人员   弹窗-->
<section bsModal #addUserNameModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
	aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title">添加审核人员</h4>
			</div>
			<form class="form-horizontal" role="form" novalidate="novalidate">
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12">
							<label class="control-label col-sm-2 no-padding-right">账户名<sup>*</sup></label>
							<div class="col-sm-10">
								<select class="form-control" select2 name="userName" id="useIdSelect" style="width: 100%;" (change)="userNameChange($event.target.value)">
									<option value="">请选择</option>
									<option *ngFor="let item of userList" [value]="item.id">{{item.name}}</option>
								</select>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="userNameClose(addUserNameModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="userNameSubmit(addUserNameModal)">提交</button>
				</div>
			</form>
		</div>
	</div>
</section>
<!-- 新增审核人员 弹窗end-->

<!-- 审核内容分配   弹窗-->
<section bsModal #allocationModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
	aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title">审核内容分配</h4>
			</div>
			<form class="form-horizontal" role="form" novalidate="novalidate">
				<div class="modal-body">
					<button type="button" class="btn btn-primary" style="margin-bottom: 10px;" (click)="addAllocation(staffPowerModal)">添加</button>
					<div class="row form-horizontal table_scroll">
						<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
							<thead>
								<tr>
									<th>审核类型</th>
									<th>审核范围</th>
									<th>创建时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<tr *ngFor="let row of allocationData; let i = index" [attr.data-index]="i">
									<td>
										<span *ngIf="row.level==1">系统级别</span>
										<span *ngIf="row.level==2">公司级别</span>
										<span *ngIf="row.level==3">车型级别</span>
										<span *ngIf="row.level==4">硬件版本级别</span>
										<span *ngIf="row.level==5">传感器级别</span>
									</td>
									<td style="display: flex; flex-flow: row wrap;">
										<span *ngFor="let rowItem of row.range; let i = index">
											{{rowItem.text}}
											<span *ngIf="row.range.length != i+1">、</span>
										</span>
										<p style="width: 100%; text-align: center;" *ngIf="row.level==1">-</p>
									</td>
									<td>{{row.createTime}}</td>
									<td>
										<button type="button" (click)="editAllocation(staffPowerModal, row, i)">编辑</button>
										<button type="button" (click)="deleteAllocation(row, i)">删除</button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</form>
		</div>
	</div>
</section>
<!-- 审核内容分配 弹窗end-->

<!-- 新增审核人员   弹窗-->
<section bsModal #staffPowerModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
	aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content" style="width: 700px;">
			<div class="modal-header">
				<h4 class="modal-title">添加权限</h4>
			</div>
			<form class="form-horizontal" role="form" novalidate="novalidate">
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12">
							<label class="control-label col-sm-2 no-padding-right">权限类型<sup>*</sup></label>
							<div class="col-sm-10">
									<select class="form-control" name="level" [(ngModel)]="level" style="width: 100%" (change)="levelChange($event.target.value)">
										<option value="1">系统级别</option>
										<option value="2">公司级别</option>
										<option value="3">车型级别</option>
										<option value="4">硬件版本级别</option>
										<option value="5">传感器级别</option>
									</select>
							</div>
						</div>
						<div class="form-group col-xs-12" [hidden]="level != 2">
							<label class="control-label col-sm-2 no-padding-right">选择公司<sup>*</sup></label>
							<div class="col-sm-10">
								<sa-company-tree-checkbox #companyTree wrap="body" companyTreeId="companyTreeFrom" [Height]="32" [companyValue]="companyArrays" (companySelected)="addCompanySelected($event)"></sa-company-tree-checkbox>
							</div>
						</div>
						<div class="form-group col-xs-12" [hidden]="level != 3">
							<label class="control-label col-sm-2 no-padding-right">选择车型<sup>*</sup></label>
							<div class="col-sm-10">
								<sa-tree-checkbox #dataTree wrap="body" htmlTreeId="carTypeDomId" [Height]="32" [dataValue]="carListArrays" (selectedValue)="selectedValue($event)"></sa-tree-checkbox>
							</div>
						</div>
						<div class="form-group col-xs-12" [hidden]="level != 4">
							<label class="control-label col-sm-2 no-padding-right">选中的固件<sup>*</sup></label>
							<div class="col-sm-10">
								<div class="clearfix fix_select2 tag-margin">
									<ul class="select2-selection__rendered">
										<li class="select2-selection__choice" *ngFor="let item of editionList; let i = index">
											{{item.text}}
											<span class="select2-selection__choice__remove" (click)="removeEditionList(i)"></span>
										</li>
									</ul>
								</div>
							</div>
						</div>
						<div class="form-group col-xs-12" [hidden]="level != 4">
							<label class="control-label col-sm-2 no-padding-right">固件版本号</label>
							<div class="col-sm-10">
								<div class="clearfix fix_select2" style="display: flex;">
									<input class="form-control" type="text" name="firmwareVs" placeholder="请输入固件版本号" [(ngModel)]='firmwareVs' autocomplete>
									<button class="btn btn-primary" (click)="addFirmwareVs()" style="margin-right: 0; border-radius: 0;">添加</button>
								</div>
							</div>
						</div>
						<div class="form-group col-xs-12" [hidden]="level != 5">
							<label class="control-label col-sm-2 no-padding-right">选择传感器<sup>*</sup></label>
							<div class="col-sm-10">
								<div class="clearfix fix_select2">
									<input type="hidden" class="form-control" id="sensorInput" name="sensorInput" placeholder="请选择" [(ngModel)]='sensorSelect'>
									<select id="sensorSelect2" style="width:100%" name="sensorSelectName" class="form-control select2" multiple placeholder="请选择"></select>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="staffPowerClose(staffPowerModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="staffPowerSubmit(staffPowerModal)">提交</button>
				</div>
			</form>
		</div>
	</div>
</section>
<!-- 新增审核人员 弹窗end-->
<style>
	.tag-margin .select2-selection__choice:first-child{
		margin-left: 0;
	}
</style>